<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>json</title>
</head>
<body>


<script>
    // js对象字面量
     var person={
         name : "peter",
         age : 29
     }


    console.log(person);

    var object={
        "name":"peter",
        "age":29,
        "school":{
            "name":"kongzuzhongxue",
            "location":"xiayixian"
        }
    }
    console.log(object);


    // js数组字面量
    var values=[25,"aha",true];
    console.log(values);
    //json数组 无变量 和 末尾分号
    [25,"aha",true]


var books=[
    {
        "title":"Professional JavaScript",
        "author":[
            "peter"
        ],
        edition:3,
        year:2008
    },
    {
        "title":"Professional JQUERY",
        "author":[
            "peter"
        ],
        edition:2,
        year:2007
    },
    {
        "title":"Professional AJAX",
        "author":[
            "peter",
            "debug",
            "bruce"
        ],
        edition:1,
        year:2006
    }
]
    /*
    console.log(typeof books);//object
    var jsonText=JSON.stringify(books);

    console.log(typeof jsonText);//json字符串
    console.log(jsonText);

    var bookCopy=JSON.parse(jsonText);
    console.log(typeof bookCopy);//object
    console.log(bookCopy);
    */
    var bookText=JSON.stringify(books,["title"]);
    console.log(bookText);

</script>





</body>
</html>